package cn.aishu.common;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * 异常封装类
 */
public class AishuException extends RuntimeException {

    private boolean isSuccess; // 是否成功
    private String message; // 返回提示信息
    private JSONObject responseData; // 其它返回数据

    public AishuException(String message) {
        super();
        this.isSuccess = false;
        this.message = message;
    }

    public AishuException(boolean isSuccess, String message) {
        super();
        this.isSuccess = isSuccess;
        this.message = message;
    }

    public AishuException(boolean isSuccess, String message, JSONObject responseData) {
        super();
        this.isSuccess = isSuccess;
        this.message = message;
        this.responseData = responseData;
    }

    public boolean isSuccess() {
        return isSuccess;
    }

    public void setSuccess(boolean success) {
        isSuccess = success;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public JSON getResponseData() {
        return responseData;
    }

    public void setResponseData(JSONObject responseData) {
        this.responseData = responseData;
    }

    @Override
    public String toString() {
        return "AishuException{" +
                "isSuccess=" + isSuccess +
                ", message='" + message + '\'' +
                ", responseData=" + responseData +
                '}';
    }
}
